<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main"/>

    <g:set var="entityName" value="${message(code: 'opportunity.label', default: 'Opportunity')}"/>
    <title>信用贷款（账务管理详情）-opportunityLayout36</title>
</head>

<body>
<input type="hidden" value="${this.opportunity?.id}" id="opportunityId">

<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb m-t-none">
                    <li>贷款管理系统</li>
                    <li>
                        <g:link controller="opportunityTeam" action="index">订单管理</g:link>
                    </li>
                    <li class="active">
                        <span>信息查看</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light">
                订单号: ${this.opportunity.serialNumber}
            <span style="font-weight: normal" class="text-info">
                【${this.opportunity?.stage?.description}】
                【保护期： <g:if test="${this.opportunity?.protectionEndTime > new Date()}">
                ${this.opportunity?.protectionEndTime - this.opportunity?.protectionStartTime}天
                </g:if>】
                <g:if test="${this.opportunity?.status == 'Failed'}">【订单结果：<span
                        class="text-danger">失败</span>】</span></g:if>
                <g:elseif test="${this.opportunity?.status == 'Completed'}">【订单结果：成功】</g:elseif>
                <g:else>【订单结果：进行中】</g:else>
            </span>

                <g:if test="${this.opportunity?.isTest}">
                    <span class="label label-danger"><i class="fa fa-star"></i> 测试 <i class="fa fa-star"></i></span>
                </g:if>
            </h2>

        </div>
    </div>
</div>

<div class="content animate-panel">

    <div class="row" id="fourth">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">

                        <g:if test="${this.opportunity.contacts?.size() > 0}">
                            <g:link target=" _blank" class="btn btn-info btn-xs" controller="creditReportConstraint"
                                    action="creditReportShow" id="${this.opportunity.id}"><i
                                    class="fa fa-database"></i>大数据</g:link>
                        </g:if>

                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                借款人及抵押人信息
            </div>

            <div class="panel-body no-padding">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover text-center">
                        <thead>
                        <tr>
                            <g:sortableColumn property="type" title="联系人"></g:sortableColumn>
                            <g:sortableColumn property="fullName" title="姓名"></g:sortableColumn>
                            <g:sortableColumn property="idNumber" title="身份证号"></g:sortableColumn>
                            <g:sortableColumn property="cellphone" title="手机号"></g:sortableColumn>
                            <g:sortableColumn property="maritalStatus" title="婚否"></g:sortableColumn>
                            <g:sortableColumn property="age" title="年龄(岁)"></g:sortableColumn>
                            <g:sortableColumn property="profession" title="职业"></g:sortableColumn>
                            <g:sortableColumn property="country" title="国籍"></g:sortableColumn>
                            <g:sortableColumn property="identityType" title="身份证件类型"></g:sortableColumn>
                            <g:sortableColumn property="monthlyIncome" title="月收入（元）"></g:sortableColumn>
                            <g:sortableColumn property="connectedType" title="新客户"></g:sortableColumn>
                            <g:sortableColumn property="isBlackList" title="反欺诈结果"></g:sortableColumn>
                            <g:sortableColumn property="level" title="是否VIP"></g:sortableColumn>

                                    <g:sortableColumn width="8%" class="text-center" property="operation" colspan="1"
                                                      title="操作"></g:sortableColumn>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${this.opportunityContacts}">
                            <tr>
                                <td>
                                    <sec:ifNotGranted roles="ROLE_COO">
                                        <g:link controller="opportunityContact" action="show"
                                                id="${it?.id}">${it?.type?.name}</g:link>
                                    </sec:ifNotGranted>
                                    <sec:ifAllGranted roles="ROLE_COO">
                                        ${it?.type?.name}
                                    </sec:ifAllGranted>
                                </td>
                                <td>
                                    <span class="nameFormat">${it?.contact?.fullName}</span>
                                </td>
                                <td  class="certificateFormat">
                                    ${it?.contact?.idNumber}
                                </td>
                                <td class="cellphoneFormat">
                                    ${it?.contact?.cellphone}
                                </td>
                                <td>
                                    ${it?.contact?.maritalStatus}
                                </td>
                                <td>
                                    <g:if test="${it?.contact?.idNumber}">
                                        ${new Date().format("yyyy").toInteger().minus(it?.contact?.idNumber[6..9].toInteger())}
                                    </g:if>
                                    <g:else>
                                        ${it?.contact?.idNumber}
                                    </g:else>
                                </td>
                                <td>
                                    ${it?.contact?.profession?.name}
                                </td>
                                <td>
                                    ${it?.contact?.country?.name}
                                </td>
                                <td>
                                    ${it?.contact?.identityType?.name}
                                </td>
                                <td>
                                    ${it?.contact?.monthlyIncome}
                                </td>
                                <td>
                                  <g:if test="${it?.contact?.clientType == 'new'}">是</g:if><g:else>否</g:else>
                                </td>
                                <td><g:if test="${it?.contact?.isBlackList}">命中</g:if><g:else>未命中</g:else></td>
                                <td><g:if test="${it?.contact?.level?.name=='A'}">是</g:if><g:else>否</g:else></td>
                                    <td class="text-center">
                                      <g:link class="btn btn-primary btn-outline btn-xs" controller="opportunityContact" action="show"
                                              id="${it?.id}">央行征信</g:link>

                                    </td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="row" id="fifth">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                费用
            </div>

            <div class="panel-body no-padding">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover text-center">
                        <thead>
                        <tr>
                            <g:sortableColumn property="executionSequence"
                                              title="${message(code: 'opportunityFlow.executionSequence.label', default: '费率类型')}"/>
                            <g:sortableColumn property="executionSequence"
                                              title="${message(code: 'opportunityFlow.executionSequence.label', default: '费率（%）')}"/>
                            <g:sortableColumn property="stage"
                                              title="${message(code: 'opportunityFlow.provider.label', default: '收费方式')}"/>
                            <g:sortableColumn property="stage"
                                              title="${message(code: 'opportunityFlow.createdDate.label', default: '上扣息月份数')}"/>
                            <g:sortableColumn property="contractType" title="合同类型"/>
                            <g:sortableColumn property="createBy"
                                              title="${message(code: 'component.createBy.label', default: '创建人')}"/>
                            <g:sortableColumn property="modifyBy"
                                              title="${message(code: 'component.modifyBy.label', default: '修改人')}"/>
                            <g:sortableColumn property="createdDate" title="创建时间"></g:sortableColumn>
                            <g:sortableColumn property="modifiedDate" title="修改时间"></g:sortableColumn>
                        </tr>
                        </thead>
                        <tbody>
                            <g:each in="${this.opportunityProduct}">
                                <tr>
                                    <td>
                                        ${it?.productInterestType?.name}
                                    </td>
                                    <td><g:formatNumber number="${it.rate}"
                                                        maxFractionDigits="9"/></td>
                                    <td>
                                        <g:if test="${it?.installments}">
                                            按月收
                                        </g:if>
                                        <g:else>
                                            一次性收
                                        </g:else>
                                    </td>
                                    <td>${it?.firstPayMonthes}</td>
                                    <td>${it?.contractType?.name}</td>
                                    <td>
                                        ${it?.createBy}
                                    </td>
                                    <td>
                                        ${it?.modifyBy}
                                    </td>
                                    <td><g:formatDate date="${it?.createdDate}"
                                                      format="yyyy-MM-dd HH:mm:ss"></g:formatDate></td>
                                    <td><g:formatDate date="${it?.modifiedDate}"
                                                      format="yyyy-MM-dd HH:mm:ss"></g:formatDate></td>
                                </tr>
                            </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">

                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                账户信息
            </div>

            <div class="panel-body no-padding">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover text-center">
                        <thead>
                        <tr>
                            <g:sortableColumn property="type" title="账户类别"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.bank" title="银行"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.paymentChannel" title="支付通道"></g:sortableColumn>

                            <g:sortableColumn property="bankAccount.numberOfAccount" title="卡号"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.name" title="账户名"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.cellphone" title="银行预留手机号"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.certificateType" title="证件类型"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.numberOfCertificate" title="证件号"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.active" title="是否验卡成功"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.bankBranch" title="支行"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.bankAddress" title="支行地址"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.createdBy" title="创建人"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.modifiedBy" title="修改人"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.createdDate" title="创建时间"></g:sortableColumn>
                            <g:sortableColumn property="bankAccount.modifiedDate" title="修改时间"></g:sortableColumn>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${this.bankAccounts}">
                            <tr>
                                <td>
                                    <g:link controller="opportunityBankAccount" action="show"
                                            id="${it?.id}">${it?.type?.name}</g:link>
                                </td>
                                <td>
                                    ${it?.bankAccount?.bank?.name}
                                </td>
                                <td>
                                    ${it?.bankAccount?.paymentChannel?.name}
                                </td>

                                <td>
                                    ${it?.bankAccount?.numberOfAccount}
                                </td>
                                <td>
                                    ${it?.bankAccount?.name}
                                </td>
                                <td class="cellphoneFormat">
                                    ${it?.bankAccount?.cellphone}
                                </td>
                                <td>
                                    ${it?.bankAccount?.certificateType?.name}
                                </td>
                                <td>
                                    ${it?.bankAccount?.numberOfCertificate}
                                </td>
                                <td>
                                    <g:if test="${it?.bankAccount?.active == true}">是</g:if>
                                    <g:if test="${it?.bankAccount?.active == false}">否</g:if>
                                </td>
                                <td>
                                    ${it?.bankAccount?.bankBranch}
                                </td>
                                <td>
                                    ${it?.bankAccount?.bankAddress}
                                </td>
                                <td>
                                    ${it?.bankAccount?.createdBy}
                                </td>
                                <td>
                                    ${it?.bankAccount?.modifiedBy}
                                </td>
                                <td>
                                    <g:formatDate date="${it?.bankAccount?.createdDate}"
                                                  format="yyyy-MM-dd HH:mm:ss"></g:formatDate>
                                </td>
                                <td>
                                    <g:formatDate date="${it?.bankAccount?.modifiedDate}"
                                                  format="yyyy-MM-dd HH:mm:ss"></g:formatDate>
                                </td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>


    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                合同信息
            </div>

            <div class="panel-body no-padding">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover text-center">
                        <thead>
                        <tr>
                            <g:sortableColumn property="contract.serialNumber" title="合同编号"></g:sortableColumn>
                            <g:sortableColumn property="contract.type" title="合同类别"></g:sortableColumn>
                            <g:sortableColumn property="contract.createdDate" title="创建时间"></g:sortableColumn>
                            <g:sortableColumn property="contract.modifiedDate" title="修改时间"></g:sortableColumn>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${this.opportunity?.contracts}">
                            <tr>
                                <td>
                                    <g:link controller="opportunityContract" action="show"
                                            id="${it?.id}">${it?.contract?.serialNumber}</g:link>
                                </td>
                                <td>
                                    ${it?.contract?.type?.name}
                                </td>
                                <td>
                                    <g:formatDate date="${it?.createdDate}"
                                                  format="yyyy-MM-dd HH:mm:ss"></g:formatDate>

                                </td>
                                <td>
                                    <g:formatDate date="${it?.modifiedDate}"
                                                  format="yyyy-MM-dd HH:mm:ss"></g:formatDate>
                                </td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                还款计划
            </div>


            <div class="panel-body no-padding">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover text-center">
                        <thead>
                        <tr>
                            <g:sortableColumn property="period" title="期数"/>
                            <g:sortableColumn property="period" title="开始时间"/>
                            <g:sortableColumn property="period" title="结束时间"/>
                            <g:sortableColumn property="period" title="应还时间（测）"/>
                            <g:sortableColumn property="period" title="实际还款时间"/>
                            <g:sortableColumn property="period" title="应付金额(元)"/>
                            <g:sortableColumn property="period" title="实收(元)"/>
                            <g:sortableColumn property="period" title="余额(元)"/>
                            <g:sortableColumn property="period" title="借方"/>
                            <g:sortableColumn property="period" title="贷方"/>
                            <g:sortableColumn property="period" title="费用类型"/>
                            <g:sortableColumn property="period" title="还款状态"/>
                            <g:sortableColumn property="period" title="是否拆分"/>
                            <g:sortableColumn property="period" title="是否早偿"/>
                            <g:sortableColumn property="period" title="是否逾期"/>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${billsItems}">
                            <tr>
                                <td>${it?.period}</td>
                                <td><g:formatDate date="${it?.startTime}" format="yyyy-MM-dd"></g:formatDate></td>
                                <td><g:formatDate date="${it?.endTime}" format="yyyy-MM-dd"></g:formatDate></td>
                                <td><g:formatDate date="${it?.payTime}" format="yyyy-MM-dd"></g:formatDate></td>
                                <td><g:formatDate date="${it?.actualEndTime}" format="yyyy-MM-dd"></g:formatDate></td>
                                <td><g:formatNumber number="${it.receivable}" minFractionDigits="2"
                                                    maxFractionDigits="9"/></td>
                                <td><g:formatNumber number="${it.receipts}" minFractionDigits="2"
                                                    maxFractionDigits="9"/></td>
                                <td><g:formatNumber number="${it.balance}" minFractionDigits="2"
                                                    maxFractionDigits="9"/></td>
                                <td>${it?.debit?.name}</td>
                                <td>${it?.credit?.name}</td>
                                <td>${it?.type?.name}</td>
                                <td>${it?.status}</td>
                                <input type="hidden" value="${it?.id}" name="billItemId">
                                <td><g:checkBox class="billsItemsChangeStatus" name="split" value="${it?.split}"/></td>
                                <td><g:checkBox class="billsItemsChangeStatus" name="prepayment" value="${it?.prepayment}"/></td>
                                <td><g:checkBox class="billsItemsChangeStatus" name="overdue" value="${it?.overdue}"/></td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                交易记录
            </div>

            <div class="panel-body no-padding">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover text-center">
                        <thead>
                        <tr>
                            %{--<g:sortableColumn property="type" title="交易类型"></g:sortableColumn>--}%
                            <g:sortableColumn property="repaymentMethod" title="扣款方式"></g:sortableColumn>
                            <g:sortableColumn property="amount" title="金额（元）"></g:sortableColumn>
                            <g:sortableColumn property="debit.name" title="借方账户名"></g:sortableColumn>
                            <g:sortableColumn property="debit.numberOfAccount" title="借方帐号"></g:sortableColumn>

                            <g:sortableColumn property="credit.name" title="贷方账户名"></g:sortableColumn>
                            <g:sortableColumn property="credit.numberOfAccount" title="贷方帐号"></g:sortableColumn>

                            <g:sortableColumn property="plannedStartTime" title="预计开始时间"></g:sortableColumn>
                            <g:sortableColumn property="plannedEndTime" title="预计完成时间"></g:sortableColumn>
                            <!-- <g:sortableColumn property="startTime" title="开始时间"></g:sortableColumn> -->
                            <g:sortableColumn property="endTime" title="实际完成时间"></g:sortableColumn>
                            <g:sortableColumn property="debitAccount" title="清分账号"></g:sortableColumn>
                            <g:sortableColumn property="status" title="交易状态"></g:sortableColumn>

                            <g:sortableColumn property="createdBy" title="创建人"></g:sortableColumn>
                            <g:sortableColumn property="modifiedBy" title="修改人"></g:sortableColumn>
                            <g:sortableColumn property="createdDate" title="创建时间"></g:sortableColumn>
                            <g:sortableColumn property="modifiedDate" title="修改时间"></g:sortableColumn>



                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${this.transactionRecords}">
                            <g:if test="${it?.status.name != '已失效'}">
                                <tr>
                                    <td>
                                        <g:link controller="transactionRecord" action="show"
                                                params="[opportunity: this.opportunity?.id]" id="${it?.id}">${it?.repaymentMethod?.name}</g:link>
                                    </td>
                                    <td>
                                        ${it?.amount}
                                    </td>
                                    <td>
                                        ${it?.debit?.name}
                                    </td>
                                    <td>
                                        ${it?.debit?.numberOfAccount}
                                    </td>
                                    <td>
                                        ${it?.credit?.name}
                                    </td>
                                    <td>
                                        ${it?.credit?.numberOfAccount}
                                    </td>

                                    <td>
                                        <g:formatDate date="${it?.plannedStartTime}"
                                                      format="yyyy-MM-dd"></g:formatDate>
                                    </td>
                                    <td>
                                        <g:formatDate date="${it?.plannedEndTime}"
                                                      format="yyyy-MM-dd"></g:formatDate>
                                    </td>
                                    <!-- <td>
                                    ${it?.startTime}
                                </td> -->
                                    <td>
                                        <g:formatDate date="${it?.endTime}"
                                                      format="yyyy-MM-dd"></g:formatDate>
                                    </td>
                                    <td>
                                        ${it?.debitAccount}
                                    </td>
                                    <td>
                                        ${it?.status?.name}
                                    </td>
                                    <td>
                                        ${it?.createdBy}
                                    </td>
                                    <td>
                                        ${it?.modifiedBy}
                                    </td>
                                    <td>
                                        <g:formatDate date="${it?.createdDate}"
                                                      format="yyyy-MM-dd HH:mm:ss"></g:formatDate>
                                    </td>
                                    <td>
                                        <g:formatDate date="${it?.modifiedDate}"
                                                      format="yyyy-MM-dd HH:mm:ss"></g:formatDate>
                                    </td>

                                </tr>
                            </g:if>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

</div>


<script>
    $(function () {
        $("body").addClass("fixed-small-header");
        if ($(".commentsContent").children().length < 1) {
            $(".commentsContent").closest(".commentsRow").remove();
        }
    })
</script>
</body>

</html>
